package com.cooper.dao.log;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.Insert;
import net.paoding.rose.jade.annotation.ReturnGeneratedKeys;
import net.paoding.rose.jade.annotation.SQL;

import com.cooper.entity.ResourceUsedEntity;

@DAO
public interface ResourceUsedDAO {
	
	static final String TABLE_NAME = "d_resource_used";
	
	@ReturnGeneratedKeys
	@Insert(tableName=TABLE_NAME)
	Long saveEntity(ResourceUsedEntity entity) throws Exception;
	
	@SQL("select count(*) TOTAL from d_resource_used where deleted='n' and origin=:1 ")
	long queryUsedCount(String origin) throws Exception;
	
	@SQL("select count(*) TOTAL from d_resource_used where deleted='n' and origin=:1 and resource_code=:2 ")
	int checkIfExists(String origin, String code) throws Exception;

}
